<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
    <title>You2play Award 2013</title>
	<link rel="icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />
	<link rel="shortcut icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />	
    <meta name="title" content="You2play Award 2013" />
    <meta name="description" content="You2play Award 2013" />
    <meta name="keywords" content="You2play Award 2013" />
    <meta property="fb:app_id" content="460477277322423" />
	<?php if(!empty($fb_image)):?>
		<meta property="og:title" content="You2play Award 2013" />
		<meta property="og:description" content="You2play Award 2013" />
		<meta property="og:image" content="<?php echo image_asset_url($asset_award_image_path.'fb_like.jpg');?>" />
		<!--<link rel='image_src' href='<?php echo image_asset_url($fb_image);?>' />-->
	<?php else:?>
		<meta property="og:title" content="You2play Award 2013" />
		<meta property="og:description" content="You2play Award 2013" />
		<meta property="og:image" content="<?php echo image_asset_url($asset_award_image_path.'fb_like.jpg');?>" />	
		<!--<link rel='image_src' href='<?php echo image_asset_url($asset_award_image_path.'fb_like.png');?>' />-->
	<?php endif;?>
    <?php echo(meta(array('name'=>'Content-type','content'=>'text/html;charset=UTF-8','type'=>'equiv')))?>
	<script type="text/javascript">
	 	/*Set Web Path*/
		var web_path = '<?php echo $award_url;?>';
	</script>
	
    <!--Load Js-->
    <?php 
    if(!empty($js)):
            foreach($js as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/js/'.$value)) && !empty($value)):
                            echo js_asset($value)."\n";				
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load Css-->
    <?php 
    if(!empty($css)):
            foreach($css as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/css/'.$value)) && !empty($value)):
                            echo css_asset($value,'', array('media'=>'all'))."\n";			
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load External Js-->
    <?php
    if(!empty($external_js)):
	?>
	<script type="text/javascript" language="javascript">
    	<?php echo $external_js;?>
	</script>
	<?php
    endif;
    ?>
    <!--Load External Css-->
    <?php
    if(!empty($external_css)):
	?>
	<style type="text/css">
    	<?php echo $external_css;?>
	</style>
	<?php
    endif;
    ?>	
</head>
<body>
	<div id="wrapper">
		<!--Header-->
		<div id="header_external" <?php echo ($this->router->method == "vote" ? 'class="headerVoted"':'');?>>
			<div id="header" <?php echo ($this->router->method == "vote" ? 'class="headerVoted"':'');?>>
				<a href="http://www.facebook.com/asahisuperdrybeer" target="_blank" style="position:absolute;width:80px;height:40px;top:40px;left:517px;cursor:pointer;"></a>
				<a href="http://www.facebook.com/BatBlast" target="_blank" style="position:absolute;width:65px;height:40px;top:42px;left:627px;cursor:pointer;"></a>
				<div id="fb-login">
					<div id="fb-root"></div>
					<script>
					  window.fbAsyncInit = function() {
					    // init the FB JS SDK
					    FB.init({
					      appId      : '<?php echo $this->config->item("fb_api");?>', // App ID from the App Dashboard
					      //channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File for x-domain communication
					      status     : true, // check the login status upon init?
					      cookie     : true, // set sessions cookies to allow your server to access the session?
					      xfbml      : true  // parse XFBML tags on this page?
					    });

					    // Additional initialization code such as adding Event Listeners goes here
						FB.getLoginStatus(function(response) {
						  if (response.status === 'connected') {
						    // connected
							var fb_id  = "<?php echo $this->session->userdata('fb_id');?>";
							var fb_name  = "<?php echo $this->session->userdata('fb_name');?>";
							if(fb_id == '' || fb_name == ''){
								FB.api('/me', function(response) {
									$.ajax({
										url:web_path+'get_user_fb',
										type:'post',
										data:({
											user_id:response.id,
											user_name:response.name
										})
									}).done(function(data){
										window.location.href = window.location.href.replace(window.location.hash,'');
									});									
								});
								//Set Loading Text
								$('#fbStatus').html('<span>ระบบกำลังโหลดข้อมูล...</span>');						
							} else {
								//Set Login name
								$('#fbStatus').html('<span>สวัสดีคุณ '+fb_name+'</span> <a class="fb logout" href="javascript:void(0);" onclick="javascript:fbLogout();"></a>');								
							}
						  } else if (response.status === 'not_authorized') {
						    // not_authorized
							$('#fbStatus').html('<a class="fb login" href="javascript:void(0);" onclick="javascript:fbLogin();"></a>');
						  } else {
						    // not_logged_in
							$('#fbStatus').html('<a class="fb login" href="javascript:void(0);" onclick="javascript:fbLogin();"></a>');
						  }
						 });
					  };

					  // Load the SDK's source Asynchronously
					  // Note that the debug version is being actively developed and might 
					  // contain some type checks that are overly strict. 
					  // Please report such bugs using the bugs tool.
					  (function(d, debug){
					     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
					     if (d.getElementById(id)) {return;}
					     js = d.createElement('script'); js.id = id; js.async = true;
					     js.src = "//connect.facebook.net/th_TH/all" + (debug ? "/debug" : "") + ".js";
					     ref.parentNode.insertBefore(js, ref);
					   }(document, /*debug*/ false));
					   
					   //Login && Logout
					   function fbLogin(){
					   	    FB.login(function(response) {
						        if (response.authResponse) {
									// connected
									FB.api('/me', function(response) {
										$.ajax({
											url:web_path+'get_user_fb',
											type:'post',
											data:({
												user_id:response.id,
												user_name:response.name
											})
										}).done(function(data){
											window.location.href = window.location.href.replace(window.location.hash,'');
										});									
									});
						        } else {
						            // cancelled
									//window.location.href = window.location.href.replace(window.location.hash,'');
						        }
						    });
					   }
					   
					   function fbLogout(){
					   		FB.logout(function(response) {
							  // user is now logged out
								$.ajax({
									url:web_path+'delete_user_fb',
									type:'get'
								}).done(function(data){
									window.location.href = window.location.href.replace(window.location.hash,'');
								});
							});
					   }
					</script>
					<div id="fbStatus"></div>
				</div>
				<a href="<?php echo $award_url;?>" class="logo"></a>
				<a href="<?php echo $award_url.'about';?>" id="top_more"></a>
				<ul>
					<li><a href="<?php echo $award_url."vote";?>" class="topMenu text_vote"></a></li>
					<li><a href="<?php echo $award_url."show";?>" class="topMenu text_show"></a></li>
					<li><a href="<?php echo $award_url."vdo";?>" class="topMenu text_vdo"></a></li>
					<li><a href="<?php echo $award_url."picture";?>" class="topMenu text_picture"></a></li>
					<li><a href="<?php echo $award_url."news";?>" class="topMenu text_news"></a></li>
					<li><a href="<?php echo $award_url."ment";?>" class="topMenu text_comment"></a></li>
				</ul>
				<a href="http://www.you2play.com" id="home_logo" title="You2play.com">&nbsp;</a>
				<?php if($this->router->method == "show" || $this->router->method == "vdo" || $this->router->method == "about"):?>
				<div id="headFrameVdo">
					<div id="vdoPlayer">
						<?php if($this->agent->is_mobile()):?>
							<video id='my_video' controls preload='none' ></video>
						<?php endif;?>
					</div>
				</div>
				<?php elseif($this->router->method == "vote"):?>
				<div id="headVote">
					<ul>
						<li class="cols1"><a href="<?php echo $award_url.'vote';?>#cat01"><h3 class="white bold">Favorite Male Artist</h3><div class="yellow bold">ศิลปินชายยอดนิยม</div></a></li>
						<li class="cols2"><a href="<?php echo $award_url.'vote';?>#cat02"><h3 class="white bold">Favorite Female Artist</h3><div class="yellow bold">ศิลปินหญิงยอดนิยม</div></a></li>
						<li class="cols1"><a href="<?php echo $award_url.'vote';?>#cat03"><h3 class="white bold">Favorite New Artist</h3><div class="yellow bold">ศิลปินหน้าใหม่ยอดนิยม</div></a></li>
						<li class="cols2"><a href="<?php echo $award_url.'vote';?>#cat04"><h3 class="white bold">Favorite Teen Pop Artist</h3><div class="yellow bold">ศิลปิน Teen Pop ยอดนิยม</div></a></li>
						<li class="cols1"><a href="<?php echo $award_url.'vote';?>#cat05"><h3 class="white bold">Favorite Duo/Group Artist</h3><div class="yellow bold">ศิลปินคู่หรือกลุ่มยอดนิยม</div></a></li>
						<li class="cols2"><a href="<?php echo $award_url.'vote';?>#cat06"><h3 class="white bold">Favorite Thai Music Video</h3><div class="yellow bold">Music Video เพลงไทยยอดนิยม</div></a></li>
						<li class="cols1"><a href="<?php echo $award_url.'vote';?>#cat07"><h3 class="white bold">Favorite Asian Artist</h3><div class="yellow bold">ศิลปินเอเชียยอดนิยม</div></a></li>
						<li class="cols2"><a href="<?php echo $award_url.'vote';?>#cat08"><h3 class="white bold">Favorite Asian Music Video</h3><div class="yellow bold">Music Video เพลงเอเชียนยอดนิยม</div></a></li>
						<li class="cols1"><a href="<?php echo $award_url.'vote';?>#cat10"><h3 class="white bold">Favorite International Music Video</h3><div class="yellow bold">Music Video เพลง International ยอดนิยม</div></a></li>			
						<li class="cols2"><a href="<?php echo $award_url.'vote';?>#cat09"><h3 class="white bold">Favorite International Artist</h3><div class="yellow bold">ศิลปิน International ยอดนิยม</div></a></li>
					</ul>				
				</div>
				<?php else:?>
				<div id="banner">
					<div class="theme-default">
						<div id="slider2" class="nivoSlider">
							<?php echo image_asset($asset_award_image_path.'head03.jpg','',array('width' => 660,'height' => 283));?>
						</div>
					</div>
				</div>
				<script type="text/javascript" language="javascript">
					$('#slider2').nivoSlider({effect: 'random',controlNav:false,pauseTime: 8000});
				</script>
				<?php endif;?>
			</div>
		</div>	
		<div id="container">
			<!--Content-->
			<div id="content"><?php echo $this->load->view($content);?></div>
		</div>
	</div>
	<div id="footer_external">
     	<div id="footer">
			<div id="footer-logo-detail">
				<ul>
					<li class="first"><a href="http://www.you2play.com" title="หน้าแรก">หน้าแรก</a>|</li>
					<li><a href="http://artist.you2play.com/" title="">ศิลปิน</a>|</li>
					<li> <a href="http://music.you2play.com/" title="ฟังเพลง">ฟังเพลง</a>|</li>
					<li><a href="http://video.you2play.com/" title="วีดีโอ">วีดีโอ</a>|</li>
					<li><a href="http://www.you2play.com/live/" title="you2playTV">ดูทีวี</a>|</li>
					<li><a href="http://movie.you2play.com/" title="ดูหนัง">ดูหนัง</a>|</li>
					<li><a href="http://www.you2play.com/news/" title="ข่าวและกิจกรรม">ข่าวบันเทิง</a>|</li>
					<li><a href="http://fashion.you2play.com/" title="แฟชั่น">แฟชั่น</a>|</li>
					<li><a href="http://saranair.you2play.com/" title="สาระแน" class="saranair">ตลก</a>|</li>
					<li><a href="http://www.you2play.com/shop/" title="ซื้อซีดี">ช้อปปิ้ง</a>|</li>
					<li><a href="http://www.you2play.com/member/profile/" title="มุมสมาชิก">มุมสมาชิก</a>|</li>
					<li><a href="http://www.you2play.com/contact/" title="ติดต่อเรา">ติดต่อเรา</a>|</li>
					<li><a href="http://www.you2play.com/content/advertising/" title="ติดต่อโฆษณา" class="advertising">ติดต่อโฆษณา</a></li>
				</ul>
				<div>
					หากคุณต้องการ แนะนำ ติ-ชม หรือมีข่าวสารที่น่าสนใจต้องการนำเสนอผ่านเว็บไซต์ <a title="ฟังเพลง" href="http://www.you2play.com">you2play.com</a> ติดต่อมาที่ <a href="mailto:webmaster@you2play.com" title="webmaster@you2play.com" target="_blank">webmaster@you2play.com</a>
					<!--True Hits-->
					<span id="true_hits"><script type="text/javascript" src="http://hits.truehits.in.th/data/r0028318.js"></script></span>
				</div>
			</div>
     	</div>
 	</div>
	<div id="toTop">^ Back to Top</div>
	
	<!--Google Analytics-->
	<script type="text/javascript">

	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-16730596-17']);
	  _gaq.push(['_trackPageview']);

	  (function() {
	    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
	</script>
</body>
</html>